{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "25d3a831",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[1, 3]\n",
      "[1, 2, 3]\n"
     ]
    }
   ],
   "source": [
    "# 列表的高级方法：\n",
    "# copy（）可以复制一份列表的备份，即使原列表发生了改变，备份后的列表也不会改变，例：\n",
    "list1 = [1,2,3]\n",
    "list2 = list1.copy()\n",
    "list1.pop(1)\n",
    "print(list1)\n",
    "print(list2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "d6c4ef7b",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[1, 3]\n",
      "[1, 2, 3]\n"
     ]
    }
   ],
   "source": [
    "#也可以通过切片的方式实现复制，例：\n",
    "list1 = [1,2,3]\n",
    "list2 = list1[:]\n",
    "list1.pop(1)\n",
    "print(list1)\n",
    "print(list2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "3fd59edb",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0 1\n",
      "1 2\n",
      "2 3\n"
     ]
    }
   ],
   "source": [
    "# 列表的枚举\n",
    "# enumerate（）可以同时取到列表的值和索引值，例：\n",
    "list1 = [1,2,3]\n",
    "for index,value in enumerate(list1):\n",
    "    print(index,value)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "fdd54f94",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
